import {
	myRequest
} from '@/utils/request.js'

/**
 * 通过id查询
 */
export const getById = (id) => {
	return myRequest({
		url: '/mallapi/orderinfo/' + id,
		method: 'get',
		showLoading: true
	});
}

/**
 * 订单结算
 */
export const preOrder = (data) => {
	return myRequest({
		url: '/mallapi/orderinfo/pre',
		method: 'post',
		data,
		showLoading: true
	});
}
/**
 * 创建订单
 */
export const createOrder = (data) => {
	return myRequest({
		url: '/mallapi/orderinfo/create',
		method: 'post',
		data,
		showLoading: true
	});
}
/**
 * 通过订单Id查询
 */
export const orderById = (id) => {
	return myRequest({
		url: '/mallapi/orderinfo/' + id,
		method: 'get',
		showLoading: true
	});
}
/**
 * 订单列表
 */
export const getPage = (data) => {
	return myRequest({
		url: '/mallapi/orderinfo/page',
		method: 'get',
		data,
		showLoading: true
	});
}
/**
 * （预支付）统一下单接口
 */
export const prepay = (data) => {
	return myRequest({
		url: '/mallapi/orderinfo/prepay',
		method: 'post',
		data,
		showLoading: true
	});
}
/**
 *订单数量查询
 */
export const getCount = (data) => {
	return myRequest({
		url: '/mallapi/orderinfo/count',
		method: 'get',
		data,
		showLoading: false
	});
}
/**
 *订单取消
 */
export const orderCancel = (id) => {
	return myRequest({
		url: '/mallapi/orderinfo/cancel/' + id,
		method: 'get',
		showLoading: false
	});
}
/**
 *订单删除
 */
export const orderDel = (id) => {
	return myRequest({
		url: '/mallapi/orderinfo/del/' + id,
		method: 'get',
		showLoading: false
	});
}
/**
 *订单确认收货
 */
export const orderReceiver = (id) => {
	return myRequest({
		url: '/mallapi/orderinfo/receiver/' + id,
		method: 'get',
		showLoading: false
	});
}
